package cn.iocoder.yudao.module.carbon.dal.mysql.emissionfactor;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.carbon.controller.admin.emissionfactor.vo.EmissionFactorExportReqVO;
import cn.iocoder.yudao.module.carbon.controller.admin.emissionfactor.vo.EmissionFactorPageReqVO;
import cn.iocoder.yudao.module.carbon.dal.dataobject.emissionfactor.EmissionFactorDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 碳排放因子 Mapper
 *
 * @author wcl
 */
@Mapper
public interface EmissionFactorMapper extends BaseMapperX<EmissionFactorDO> {

    default PageResult<EmissionFactorDO> selectPage(EmissionFactorPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<EmissionFactorDO>()
                .likeIfPresent(EmissionFactorDO::getLevel3c, reqVO.getLevel3c())
                .likeIfPresent(EmissionFactorDO::getReleaseYear, reqVO.getReleaseYear())
                .orderByAsc(EmissionFactorDO::getId));
    }

    default List<EmissionFactorDO> selectList(EmissionFactorExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<EmissionFactorDO>()
                .likeIfPresent(EmissionFactorDO::getReleaseYear, reqVO.getReleaseYear())
                .orderByAsc(EmissionFactorDO::getId));
    }

}
